package demo

import (
	"context"
	"userver/gate/logic"
	"userver/protos/pbdemo"

	"gitee.com/cloudapex/ulern/htp"
	"github.com/gin-gonic/gin"
)

/*
 * 描述: 测试接口
 * 路由: /demo/Hello
 * 方法: GET
 *********************************************************************/
type Hello struct {
	Id    int64  `form:"id" binding:"omitempty"`    // -- ID (新PID)
	ProId int64  `form:"proId" binding:"omitempty"` //	-- 项目ID(老PID)
	Name  string `form:"name" binding:"required"`   //	-- 项目名称
	CId   int64  `form:"cid" binding:"omitempty"`   //	-- 公司ID
	State int64  `form:"state" binding:"omitempty"` //  -- 状态 默认1，启用 2.关闭
}

func (this *Hello) Handle(c *gin.Context, ctx context.Context) htp.Response {

	rsp, err := logic.DemoCli.Hello(ctx, &pbdemo.HelloReq{Data: this.Name})
	if err != nil {
		return htp.RespRPCErr("", err)
	}

	return htp.RespOK("", &struct {
		Content interface{} `json:"content"`
	}{rsp.Data})
}
